package com.food.platformmsgmanagement.domain;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.util.Date;

/**
 * 评论，值对象
 * TODO 评论应该有业务逻辑，但暂时没想好
 * @author 24270
 */
@Data
@Table("comment")
public class Comment {
    @Id
    @Column(value = "id")
    private CommentId id;
    @Column(value = "alimentId")
    private String alimentId;
    @Column(value = "userName")
    private String userName;
    @Column(value = "mainText")
    private CommentText mainText;
    private Date date;

    public Comment(String alimentId, String userName, String mainText) {
        this.id = new CommentId();
        this.alimentId = alimentId;
        this.userName = userName;
        this.mainText = new CommentText(mainText);
        this.date = new Date();
    }
}
